<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,user-scalable=no,maximum-scale=1.0,minimum-scale=1.0" />
<meta content="telephone=no" name="format-detection" />
<title>樱淘社</title>
<link href="<{$res_url}>/css/wap/public.css" rel="stylesheet" type="text/css">
<link href="<{$res_url}>/css/wap/home.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="<{$res_url}>/js/wap/jquery.min.js"></script>
<!------显示/隐藏密码-------->
<script src="<{$res_url}>/js/wap/jquery.toggle-password.min.js"></script>
<script>
	$(function(){
		$('#password').togglePassword({
			el:'#togglePassword',
		});
	});
</script>
<!-----发送验证码倒计时----->
<script type="text/javascript">
	var InterValObj; 
	var count = 60; 
	var curCount;
	var code = ""; 
	var codeLength = 6;
	function sendMessage() {
		if($('#phone').val()){
			$.ajax({
				type:'post',
				dataType: 'json',
				url: '<{$url}>',
				async: true,
				data: {uname:$('#phone').val(),type:'forgot'},
				success: function (msg) {
					if(msg.rsp == 'fail'){
						alert(msg.data);
					}
				}
			});
		}else{
			alert('请输入手机号');
			return false;
		}
		curCount = count;
		var dealType;
			$("#btnSendCode").attr("disabled", "true");
			$("#btnSendCode").text(curCount + "S");
			InterValObj = window.setInterval(SetRemainTime, 1000);
		}
	function SetRemainTime() {
		if (curCount == 0) {                
			window.clearInterval(InterValObj);
			$("#btnSendCode").removeAttr("disabled");
			$("#btnSendCode").text("重新获取");
			code = "";    
		}
		else {
			curCount--;
			$("#btnSendCode").text(curCount + "S");
		}
	}
	$(function(){
		$('#btn1').bind('click',function(){
			var url = '<{$curl}>';
			var data = {phone:$('#phone').val(),key:$('#key').val(),password:$('#password').val()};
			$.post(url,data,function(msg){
				if(msg.rsp == 'fail'){
					alert(msg.data);
				}else{
					window.location.href = '<{$indexurl}>';
				}
			},'json');
		});
	});
</script>
</head>

<body>
	
    <section class="warp">
    	<div class="content">
            <header>
                <div class="search fl"><a href="#"><img src="<{$res_url}>/images/wap/icon1.png" width="20"></a></div>
                <div class="logo">重置密码</div>
            </header>
            
            <section class="reg">
                    <ul>
                        <li>
                        	<span><img src="<{$res_url}>/images/wap/icon6.png"></span>
                        	<input name="" type="text" placeholder="请输入手机号码" id="phone">
                        	<button id="btnSendCode" onclick="sendMessage()">获取验证码</button>
                        </li>
                        <li><span><img src="<{$res_url}>/images/wap/icon7.png"></span><input name="" id="key" type="text" placeholder="短信验证码"></li>
                        <li><span><img src="<{$res_url}>/images/wap/icon8.png"></span><input name="" id="password" type="password" placeholder="新的密码"><i id="togglePassword"></i></li>
                        <li><button id="btn1">确认重置密码</button></li>
                    </ul>
            </section>
        </div>
    </section>
    
</body>
</html>